import java.util.Stack;

public class Minstack {
    private Stack<Integer> stack;
    private Stack<Integer> minstack;
    public Minstack(){
        stack = new Stack<>();
        minstack = new Stack<>();
    }
    public void push(int val){
        if(minstack.empty()){
            stack.push(val);
            minstack.push(val);
            return;
        }
        if(val <= minstack.peek()){
            stack.push(val);
            minstack.push(val);
        }else{
            stack.push(val);
        }
    }

}
